
#ifndef   __SIMPHONY_EEPROM
#define   __SIMPHONY_EEPROM

#define   PREFIX_MAXIMUM				200
#define   PREFIX_SIZE					9

#define   NMS_PHONE_LIST_MAXIMUM		16

/* E E P R O M   M A P P I N G */

#define   INTERNAL_EEPROM_MAX_ADDRESS					0x3FF

/* if '0x01' - SECOND half of flash space, any another value - FIRST half*/
//#define   E2_ADDR_PROGRAM_POINTER						0x00 
#define   E2_ADDR_BOOT_STATUS								0x00 
#define   E2_ADDR_MANUFACTURE_TEST						0x01
#define   E2_ADDR_MODE										0x02 /* Normal == 0xFF or Standalone == 0 */

#define   E2_ADDR_P_NMS_PHONE_LIST						0x04 /* 2 bytes */
#define   E2_ADDR_SMS_ITEMS_COUNT						0x06
#define   E2_ADDR_SMS_DISPLAY_STRING_COUNT			0x07


#define   E2_ADDR_CONFIG_FILE								0x10 /* 4 bytes */

#define   E2_ADDR_GLOBAL_MONEY_COUNTER					0x20 /* 4 bytes */
#define   E2_ADDR_PASSWORD_OWNER							0x30 /* 7 bytes */
#define   E2_ADDR_PASSWORD_MASTER						0x38 /* 7 bytes */
#define   E2_ADDR_PASSWORD_INSTALLER					0x40 /* 10 bytes */

#define   E2_ADDR_NMS_PHONE_LIST							0x50 /* 16 x 17 = 272 */

#define   E2_ADDR_MY_PHONE_NUMBER						0x200
#define   E2_ADDR_MY_IMSI_NUMBER							0x220
#define   E2_ADDR_MY_IMEI_NUMBER							0x230

#define   E2_ADDR_SMS_USER_NEW_MESSAGE_COUNT			0x240
#define   E2_ADDR_OWNER_IMSI_NUMBER						0x242	/* 16 bytes */

#define   E2_ADDR_NEIGHBOR_CELLS							0x252	/* 48 bytes */

/* #define   E2_ADDR_MY_PHONE_NUMBER						(INTERNAL_EEPROM_MAX_ADDRESS-20) */
/* #define   E2_ADDR_MY_IMSI_NUMBER								(E2_ADDR_MY_PHONE_NUMBER-20) */
/* //#define   E2_ADDR_NMS_PHONE_NUMBER						(E2_ADDR_MY_IMSI_NUMBER-20)  */
/* #define   E2_ADDR_SMS_USER_NEW_MESSAGE_COUNT			(E2_ADDR_NMS_PHONE_NUMBER-20) */

//#define   E2_ADDR_P_SMS_USER_NEW_MESSAGE_NUMBERS	(E2_ADDR_SMS_USER_NEW_MESSAGE_NUMBERS-1)

/* END OF EEPROM MAPPING */

unsigned char e2_Read( unsigned int Address );
void e2_Write( unsigned int Address, unsigned char Ch );
void E2_SaveTo( unsigned int Address, unsigned char *Buffer, unsigned char ByteCount );
void E2_LoadFrom( unsigned char *Buffer, unsigned int Address, unsigned char ByteCount );
void E2_Delete( unsigned int Address, unsigned int ByteCount );

//void E2_Str_SaveTo( unsigned int Address, unsigned char* Str);
void E2_Str_SaveTo( unsigned int Address, register const unsigned char *Str );
unsigned char E2_Str_LoadFrom( unsigned char* Str, unsigned int Address );

unsigned char e2_Str_Load_Number( unsigned char* Str, unsigned int Address );
int E2_StrCmp( register const unsigned char* Reference, unsigned int Address );
void E2_PrintStr(unsigned int Address, unsigned char X, unsigned char Y, unsigned char ClearDisplay);
//unsigned char* e2_Str_Load_Number( unsigned char* Str, unsigned int Address );


#endif

